package com.cssy.xxkj.logic.dao.impl;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicCheckBackDAO;
import com.cssy.xxkj.logic.entity.LogicCheckBackDO;
import com.plat.helper.SearchConditions;

/**
 * 数据访问对象实现类
 * @since 2014-11-12
 */
public class LogicCheckBackDAOImpl extends SqlMapClientDaoSupport implements LogicCheckBackDAO {

    /**
     * 插入数据
     * @param logicCheckBackDO
     * @return 插入数据的主键
     */
    public String insertLogicCheckBackDO(LogicCheckBackDO logicCheckBackDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicCheckBack.insert", logicCheckBackDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicCheckBackDO
     * @return 查出的记录数
     */
    public Integer countLogicCheckBackDOByExample(LogicCheckBackDO logicCheckBackDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicCheckBack.countByDOExample", logicCheckBackDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicCheckBackDO
     * @return 受影响的行数
     */
    public Integer updateLogicCheckBackDO(LogicCheckBackDO logicCheckBackDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicCheckBack.update", logicCheckBackDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicCheckBackDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicCheckBackDO> findListByExample(LogicCheckBackDO logicCheckBackDO) throws DataAccessException {
        List<LogicCheckBackDO> list = getSqlMapClientTemplate().queryForList("LogicCheckBack.findListByDO", logicCheckBackDO);
        return list;
    }

    /**
     * 根据主键获取logicCheckBackDO
     * @param id
     * @return logicCheckBackDO
     */
    public LogicCheckBackDO findLogicCheckBackDOByPrimaryKey(String id) throws DataAccessException {
        LogicCheckBackDO logicCheckBackDO = (LogicCheckBackDO) getSqlMapClientTemplate().queryForObject("LogicCheckBack.findByPrimaryKey", id);
        return logicCheckBackDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicCheckBackDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicCheckBack.deleteByPrimaryKey", id);
        return rows;
    }

	@Override
	public List<LogicCheckBackDO> find(SearchConditions scs)
			throws DataAccessException {
		return getSqlMapClientTemplate().queryForList("LogicCheckBack_ex.find",scs);
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		return (Integer) getSqlMapClientTemplate().queryForObject("LogicCheckBack_ex.count", scs);
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		return getSqlMapClientTemplate().update("LogicCheckBack_ex.deleteBizRemoved", id);
	}
    
    

}